﻿@using WebApplication1.Models
@model Main

@{
    ViewBag.Title = "Index";
}

@using (Html.BeginForm())
{
    @Html.EditorFor(model => model.UserList.Name)
    @Html.HiddenFor(model => model.UserList.Name)
    <br />

    <fieldset>
        <legend>My Favourite Movies</legend>

        @if (Model.UserList.FavouriteMovies == null || Model.UserList.FavouriteMovies.Count == 0)
        {
            <p>None.</p>
        }
        <ul id="movieEditor" style="list-style-type: none">
            @if (Model.UserList.FavouriteMovies != null)
            {
                foreach (Movie movie in Model.UserList.FavouriteMovies)
                {
                    Html.RenderPartial("MovieEntryEditor", movie);
                }
            }
        </ul>

    </fieldset>

    <br />
    <p>
        <input type="submit" value="Save" />
    </p>
}

